<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" href="../../css/iuapmobile.um.css">
        <link rel="stylesheet" href="../../css/font-icons.css">
        <link rel="stylesheet" type="text/css" href="../../css/iuapmobile.um.listview.css">
        <link rel="stylesheet" type="text/css" href="../../css/iuapmobile.um.listview.css">

        <style>
        	.msg-info {
        		position: relative;
        	}
        	.msg-info .um-badge {
        		position: absolute;
        		right: -10px;
        		font-size: 12px;
        	}
        	.msg-header {
        		width: 40px;
        		height: 40px;
        		line-height: 40px;
        		background: blue;
        		border-radius: 50%;
        		text-align: center;
        		color: white;
        	}
        	.um-listview-row:active{
        		background-color:#eee;
        	}
        </style>

        <script src="../../js/summer.js" ></script>
        <script src="../../js/jquery.min.js" ></script>
        <script src="../../js/Frameworks/iuapmobile.frameworks.ui.js" ></script>
        <script src="../../js/knockout.js"></script>
        <script src="../../js/Frameworks/iuapmobile.frameworks.listview.js"></script>
        <style>
            .msg-info {
                position: relative;
            }
            .msg-info .um-badge {
                position: absolute;
                right: -10px;
                font-size: 12px;
            }
            .msg-header {
                width: 40px;
                height: 40px;
                line-height: 40px;
                background: blue;
                border-radius: 50%;
                text-align: center;
                color: white;
            }
        </style>

           <script type="text/javascript" src="../../js/knockout.js"></script>
        <script type="text/javascript" src="../../js/Frameworks/iuapmobile.frameworks.listview.js"></script>
 </head>
    <body>
        <div class="um-win" id="list">
            <!-- <div class="um-header" >
            <h3>导航栏</h3>
            </div> -->
             <div class="um-header">
				<a href="#" class="um-back" id="close"> 返回 </a>
				<h3>勘察单列表</h3>
				<a href="#" class="um-header-right">
				<p>
					<!--<span class="menu">新增</span>-->
				</p> </a>
			</div> 
			<div class="um-input-group" >  
			<span class="ti-search" id="search"></span>
              	<input  type="search" class="form-control" placeholder="请输入过滤条件" id="searchCode">
                <button id="searchlist" class="btn btn-inline" >&nbsp;&nbsp;搜&nbsp;索&nbsp;&nbsp;</button>
             </div>
               
            <div id="content" class="um-content">
               <div class="um-listview-wrap" id="listview">
               		<div class="hd1 pt15 pb15 f15" style="text-align: center;">
						<span class="ti-reload"></span> 没有找到数据 点击刷新
					</div>
               	<ul class="um-list um-no-active" data-bind="foreach: data">
						<li class="um-listview-row" >
							<a href="#" class="um-list-item um-swipe-action um-no-icon">
							<div class="um-list-item-inner">
								<div class="um-list-item-body um-text-overflow f14" style="padding-right:5px;">
									<div class="um-bgc-blue um-white pt5 pb5 ">
										︱商家编号(合同编号):<span data-bind="text:sjbh1"></span>
									</div>
									<div class="w">
										<div class="um-md-12  fl mt10 mb10">
											派工日期:<span data-bind="text:pgsj1"></span>
										</div>
									</div>
									<div class="w">
										<div class="um-md-12  fl mt10 mb10">
											商家经营名称:<span data-bind="text:sjjymc1"></span>
										</div>
										
									</div>
									<div class="w">
										<div class="um-md-12 w_50 fl mt10 mb10">
											点位编号:<span data-bind="text:dwbh1"></span>
										</div>
									
									</div>
									<div class="w">
										<div class="um-md-12 w_50 fl mt10 mb10">
											是否停用:<span style="color: red" data-bind="text:stopstatus=='Y'?'已停用':'启用中'"></span>
										</div>
									</div>
								</div>
							</div> </a>
						</li>
					</ul>
					<p id="displaymore" style="text-align: center;margin-top: 10px;margin-bottom: 10px;">查看更多</p>
               </div>

            </div>

            <!-- <div class="um-footer">

            </div> -->
        </div>

   
        <script>
        	var pageIndexNow = 1; //当前第几页
        	$(function() {
        	     $('#close').click(function(){
					summer.closeWin();
				});
				 $("#searchlist").click(function() {//给输入框绑定按键事件
			        window.bind();
			        changeLoadingTitle();
			    });
			    //构造控件实例
        		var listview = UM.listview("#listview");
        		//Knockout绑定
        		var ViewModel = function() {
        		};
        		
        	
        		var viewModel = new ViewModel();
        		viewModel.data = ko.observableArray([]);
        		ko.applyBindings(viewModel);
			    var bind = function(Pageindex) {
					var userinfo = summer.getStorage("userinfo");
					doPost(adressHead.IAzpgDwkcImpl2, "getAzPgKcxxList", { //getAzPgxxList   getAcceptanceCheckList
						dataParm: {
							empId: userinfo.empId,
							star: Pageindex == 1 ? 1 : (((Pageindex - 1) * 7) + 1),
							count: 7,
							dwkcsjmc_hth:$("#searchCode").val(),
						}
					}, function(jsons) {
					    var jsonArray = [];
						var binddata = jsons.data;
						for(var i=0;i<binddata.length;i++){
							var a = binddata[i];
							jsonArray.push({
								bodyid:a.bodyid,
								sjbh1:a.sjbh1,
								pgsj1:a.pgsj1,
								sjjymc1:a.sjjymc1,
								dwbh1:a.dwbh1,
								stopstatus:a.stopstatus
							});
						}
						
						binddata = jsonArray;
						console.log(binddata);
						
						if(Pageindex == 1) {
							try {
								while(viewModel.data.shift()) {}
								listview.refresh();
							} catch(e) {}
						}

						if(binddata.length == 0) {
						    $("#displaymore").css("display", "none"); //show
							if(Pageindex == 1) {
								$(".hd1").css("display", "block"); //show
							}
							UM.toast({
								title: '友情提示：',
								text: '没有数据了'
							});
						} else {
							pageIndexNow = Pageindex;
							$("#displaymore").css("display", "block"); //show
							$(".hd1").css("display", "none"); //hide
						}
						for(var i = 0; i < binddata.length; i++) {
							
							viewModel.data.push(binddata[i]);
						}
						listview.refresh();
						//init();
					});
				}
				$("#displaymore").click(function() {
				
				 bind(pageIndexNow + 1);
				 sender.refresh();
				changeLoadingTitle();
				
				});
			    window.bind = function(ind) {
					if(!ind){
						ind = 1;
					}
					bind(ind);
				};

				$(".hd1").click(function() {
					bind(1);
				});
        		
				summerready = function() {
					bind(1);
				}        		
        	
        		//添加控件方法
        		listview.on("pullDown", function(sender) {
        			bind(1);
					sender.refresh(); 
					changeLoadingTitle();
        		});
        		listview.on("itemClick", function(sender, args) {
        		var bodyid= viewModel.data()[args.rowIndex].bodyid;
        			summer.openWin({
						id : "index",
						url : "html/xianchangkancha/insert.html",
						isKeep: true,
						reload: true,
						pageParam : {
					    	'bodyid':bodyid
					    	}
					});
        		});
        		
        	});	
	

			
        </script>
 </body>

</html>
<script src="../../js/Myjs/Common.js"></script>